package cn.android.weblog;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import cn.android.weblog.redisdata.LOGIN;

public class MyActivity extends AppCompatActivity {

    private ImageView toIndex;
    private Button information,changePass,publish,write,draft,recycle,catagory,logout,collection;
    private TextView name;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my);

        toIndex=(ImageView)findViewById(R.id.my_index);
        information=(Button)findViewById(R.id.my_information);
        changePass=(Button)findViewById(R.id.my_changePass);
        publish=(Button)findViewById(R.id.my_publish);
        write=(Button)findViewById(R.id.my_write);
        draft=(Button)findViewById(R.id.my_drafts);
        recycle=(Button)findViewById(R.id.my_recycle);
        catagory=(Button)findViewById(R.id.my_catagory);
        collection=(Button)findViewById(R.id.my_collection);
        logout=(Button)findViewById(R.id.my_logout);
        name=(TextView)findViewById(R.id.my_name);

        // 我的分类
        catagory.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,MyCatagoryActivity.class));
            }
        });

        // 我的收藏
        collection.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,MyCollectActivity.class));
            }
        });

        // 新增博文
        write.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,WritePassageActivity.class));
            }
        });


        // 草稿箱
        draft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,MyDraftActivity.class));
            }
        });

        // 我的发布
        publish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,MyBlogActivity.class));
            }
        });

        // 回收站
        recycle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,MyDeleteActivity.class));
            }
        });

        // 修改密码
        changePass.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,ChangePasswordActivity.class));
            }
        });

        // 我的信息
        information.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,MyInformationActivity.class));
            }
        });

        // 退出登录
        logout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LOGIN.USER=null;
                startActivity(new Intent(MyActivity.this,LoginActivity.class));
            }
        });

        // 返回首页
        toIndex.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyActivity.this,IndexActivity.class));
            }
        });

    }
}
